#
#  untitled.rb
#  
#
#  Created by Zhang Ximin on 8/4/10.
#  Copyright (c) 2010 Columbia University. All rights reserved.
#

# Set class path variables
html_rep_dir = '/Users/xz2210/Christine_Columbia/Summer_Internship_2010/shermanstravelmedia/environment/html_class_v2'
# Load classes
require 'watir'
#require 'test/unit'
#require 'spec'
require 'mysql'
require 'DBI'
require "#{html_rep_dir}/classes/html.class"

# Set variables
site = "http://www.shermanstravel.com/luxury/"
#site = "http://www.google.com/"
browser_type = 'Firefox'
# browser_type = 'IE'
# browser_type = 'safari'
# Watir::Browser.default = 'firefox'
test_environment = 'QA'
email_init = "zhangxmbxy@hotmail.com"


# The main test

# initialize HTML report
@html = HTMLReport.new()
# createReport(reportName, header, browser_type)
@report = @html.createReport('general_test', 'shermanstravle test', browser_type)

# begin
begin
  if browser_type == 'IE'
    @browser = Watir::Browser.start(site)
  elsif browser_type == 'Firefox'
    Watir::Browser.default = 'firefox'
    @browser = Watir::Browser.start(site)
  end
  
  
  #=================TOP25=================
  test_case = @html.newTestName('TOP25 VERIFY')
  test = ' top 25 signup check '
#  test = 'Check search text field'
  @html.add_to_report(@browser.text_field(:name, 'q').exists?, test, 'PASS: Located search text field', 'FAIL: Unable to locate search field')
  

  #def test_teardown # @html.add_to_report(true, test_title, 'PASS: Email Info has been stored/Info about this email  exists', 'FAIL: Unable to store email infomation')
   
 # teardown
  @browser.close
  @html.finishReport(@report, browser_type, test_environment)
  
  rescue => e
  puts $!
  puts e.backtrace
  @html.finishReport(@report, browser_type, test_environment)
    #~ @browser.close

end

